<style lang="scss" scoped>
	.earnings-info-top {
		background: $themeColor url(../../common/images/newIcon/bg-common.png) no-repeat;
		background-size: 100%;
		// min-height: 150px;
		margin-bottom: 10px;
		text-align: center;
		padding: 40px;
	}

	.earnings-info-top-title {
		color: #fff;
		margin-top: 10px;
	}

	.earnings-info-top-number {
		color: #fff;
		margin-top: 10px;
		font-weight: 600;
		font-size: 20px;
	}

	.u-cell-item__title,
	.u-cell-item__value {
		margin-top: 10px;
		margin-bottom: 10px;
	}

	.value-style {
		margin-left: -50px;
	}

	/deep/.u-cell__value {
		word-wrap: break-word;
	}
</style>
<template>
	<div>
		<div>
			<div class="earnings-info-top">
				<div class="earnings-info-top-title">金额</div>
				<div class="earnings-info-top-number">{{ toFixedNum(customData.amount) }}</div>
			</div>
		</div>

		<div class="earnings-info">
			<u-cell-item :arrow="false" title="提现订单号" :value="customData.orderNo" @click="copy(customData.orderNo)">
				<template slot="right-icon">
					<span class="iconfont icon-niantie copy"></span>
				</template>
			</u-cell-item>
			<u-cell-item :arrow="false" title="代理商编号" :value="customData.agentNo" />
			<u-cell-item :arrow="false" title="代理商名称" :value="customData.agentName" />
			<u-cell-item :arrow="false" title="提现账户类型" :value="customData.accountType | accountTypeFilters" />
			<u-cell-item :arrow="false" title="提现日期" :value="customData.transDate" />
			<u-cell-item :arrow="false" title="变动金额" :value="'¥' + toFixedNum(customData.amount)" />
			<u-cell-item :arrow="false" title="手续费"
				:value="toFixedNum(customData.fee) ? toFixedNum(customData.fee) : '-'" />
			<u-cell-item :arrow="false" title="变动前余额" :value="customData.beforeAmount" />
			<u-cell-item :arrow="false" title="变动后余额" :value="customData.afterAmount" />
			<u-cell-item :arrow="false" title="实际到账金额" :value="customData.toAmount" />
			<u-cell-item :arrow="false" title="提现状态">{{customData.status | statusFilters}}</u-cell-item>
			<u-cell-item :arrow="false" title="审核状态" :value="customData.auditStatus | auditStatusFilters" />
			<u-cell-item :arrow="false" title="审核描述" :value="customData.auditMsg" />
			<u-cell-item :arrow="false" title="审核日期" :value="customData.auditDate" />
			<u-cell-item :arrow="false" title="到账名称(公司名/持卡人姓名)" :value="customData.accountName" />
			<u-cell-item :arrow="false" title="到账卡号/公账ID" :value="customData.accountNo" />
			<u-cell-item :arrow="false" title="到账银行名称" :value="customData.bankName" />
		</div>
	</div>
</template>

<script>
	export default {
		name: 'earningsWithdrawalInfo',
		components: {},
		data() {
			return {
				customData: {}
			};
		},
		onLoad() {
			let option = this.$storage.getStore('earningsWithdrawalInfo') || {};
			this.customData = option || {};
			const accountNo = this.customData.accountNo
			this.customData.accountNo =
				accountNo?.substring(0, 6) +
				" **** " +
				accountNo?.substring(accountNo.length - 6, accountNo.length);
			// this.$nextTick(() => {
			// 	this.queryMethod();
			// });
		},
		onUnload() {
			this.$storage.removeStore('earningsInfo');
		},
		filters: {
			accountTypeFilters(value) {
				let str = "";
				switch (value) {
					case 0:
						str = '对私';
						break;
					case 1:
						str = '对公';
						break;
					case 2:
						str = '支付宝';
						break;
					default:
						break;
				}
				return str;
			},
			statusFilters(value) {
				let str = "";
				switch (value) {
					case 0:
						str = '待提现';
						break;
					case 1:
						str = '提现中';
						break;
					case 2:
						str = '提现成功';
						break;
					case 3:
						str = '提现失败';
						break;
					case 4:
						str = '提现取消';
						break;
					default:
						break;
				}
				return str;
			},
			auditStatusFilters(value) {
				let str = "";
				switch (value) {
					case 0:
						str = '待审核';
						break;
					case 1:
						str = '审核成功';
						break;
					case 2:
						str = '审核失败';
						break;
					default:
						break;
				}
				return str;
			}
		},
		methods: {
			copy(value) {
				let _this = this;
				uni.setClipboardData({
					data: value,
					success: function() {
						_this.$tip.toast('复制成功!');
					}
				});
			},
		}
	};
</script>